package com.ruoyi.web.controller.net;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.net.domain.ElementSrSrtpProtect;
import com.ruoyi.net.service.IElementSrSrtpProtectService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 网元-SR-srtp-保护属性Controller
 * 
 * @author net
 * @date 2024-11-17
 */
@Api(tags = "网元-SR-srtp-保护属性")
@RestController
@RequestMapping("/element/sr/srtp/protect")
public class ElementSrSrtpProtectController extends BaseController
{
    @Autowired
    private IElementSrSrtpProtectService elementSrSrtpProtectService;

    /**
     * 查询网元-SR-srtp-保护属性列表
     */
    @ApiOperation(value = "查询网元-SR-srtp-保护属性列表", httpMethod = "GET")
    //    @PreAuthorize("@ss.hasPermi('system:protect:list')")
    @GetMapping("/list")
    public TableDataInfo list(ElementSrSrtpProtect elementSrSrtpProtect)
    {
        startPage();
        List<ElementSrSrtpProtect> list = elementSrSrtpProtectService.selectElementSrSrtpProtectList(elementSrSrtpProtect);
        return getDataTable(list);
    }

    /**
     * 导出网元-SR-srtp-保护属性列表
     */
    @ApiOperation(value = "导出网元-SR-srtp-保护属性列表", httpMethod = "POST")
    //    @PreAuthorize("@ss.hasPermi('system:protect:export')")
    @Log(title = "网元-SR-srtp-保护属性", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ElementSrSrtpProtect elementSrSrtpProtect)
    {
        List<ElementSrSrtpProtect> list = elementSrSrtpProtectService.selectElementSrSrtpProtectList(elementSrSrtpProtect);
        ExcelUtil<ElementSrSrtpProtect> util = new ExcelUtil<ElementSrSrtpProtect>(ElementSrSrtpProtect.class);
        util.exportExcel(response, list, "网元-SR-srtp-保护属性数据");
    }

    /**
     * 获取网元-SR-srtp-保护属性详细信息
     */
    @ApiOperation(value = "获取网元-SR-srtp-保护属性详细信息", httpMethod = "GET")
    //    @PreAuthorize("@ss.hasPermi('system:protect:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(elementSrSrtpProtectService.selectElementSrSrtpProtectById(id));
    }

    /**
     * 新增网元-SR-srtp-保护属性
     */
    @ApiOperation(value = "新增网元-SR-srtp-保护属性", httpMethod = "POST")
    //    @PreAuthorize("@ss.hasPermi('system:protect:add')")
    @Log(title = "网元-SR-srtp-保护属性", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ElementSrSrtpProtect elementSrSrtpProtect)
    {
        return toAjax(elementSrSrtpProtectService.insertElementSrSrtpProtect(elementSrSrtpProtect));
    }

    /**
     * 修改网元-SR-srtp-保护属性
     */
    @ApiOperation(value = "修改网元-SR-srtp-保护属性", httpMethod = "PUT")
    //    @PreAuthorize("@ss.hasPermi('system:protect:edit')")
    @Log(title = "网元-SR-srtp-保护属性", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ElementSrSrtpProtect elementSrSrtpProtect)
    {
        return toAjax(elementSrSrtpProtectService.updateElementSrSrtpProtect(elementSrSrtpProtect));
    }

    /**
     * 删除网元-SR-srtp-保护属性
     */
    @ApiOperation(value = "删除网元-SR-srtp-保护属性", httpMethod = "DELETE")
    //    @PreAuthorize("@ss.hasPermi('system:protect:remove')")
    @Log(title = "网元-SR-srtp-保护属性", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(elementSrSrtpProtectService.deleteElementSrSrtpProtectByIds(ids));
    }
}
